<template>
	<!-- 添加或修改地址 -->
	<view class="addormodify">
		<view class="modify public_sty">
			<view class="modify_input">
				<view class="modify_sty"><text class="" style="letter-spacing: 8px;">收货人</text></view>
				<view class=""><input type="text" v-model="receiv.name" value="" placeholder="请填写收货人姓名" placeholder-style="color:#C0C0C0;font-size:14px" /></view>
			</view>
			<view class="modify_input">
				<view class="modify_sty"><text class="">手机号码</text></view>

				<view class="flex">
					<text>+86</text>
					<uni-icons type="arrowdown"></uni-icons>
					<input type="text" v-model="receiv.phone" value="" placeholder="请填写收货人手机号" placeholder-style="color:#C0C0C0;font-size:14px" />
				</view>
			</view>
			<view class="modify_input">
				<view class="modify_sty"><text class="">所在地区</text></view>
				<view class="flex">
					<input type="text" value="" v-model="receiv.address" placeholder="省市区县、乡镇等" placeholder-style="color:#C0C0C0;font-size:14px" />
					<uni-icons type="location"></uni-icons>
					<text style="color: #C0C0C0; width: 20%;font-size:14px">定位</text>
				</view>
			</view>
			<view class="modify_input">
				<text class="modify_sty">详细地址</text>
				<input type="text" value="" v-model="receiv.detailress" placeholder="街道、楼牌号等" placeholder-style="color:#C0C0C0;font-size:14px" />
			</view>
		</view>
		<view class="modify_paste public_sty">
			<view class="" style="font-size: 14px;"><text>地址粘贴板</text></view>
			<view class="size" style="color: #C0C0C0;margin-top: 24rpx;"><text>试试粘贴收件人姓名、手机号、收货地址、可快速识别您的收货信息</text></view>
		</view>
		<view class="modify_default public_sty">
			<view class="default_left">
				<text class="">设置默认地址</text>
				<view class="textSty"><text>提醒：每次下单会默认推荐使用该地址</text></view>
			</view>
			<view class="default_right "><switch :checked="receiv.defult" @change="swithBtn" type="switch" /></view>
		</view>
		<button class="preservation" type="primary"><text>保存并使用</text></button>
		<button type="default" class="delete"><text style="color: #00B359;">删除地址</text></button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			type:0,
			receiv: {
				name: '',
				phone: '',
				address: '',
				detailress: '',
				defult: false
			}
		};
	},
	onLoad(options) {
		// console.log(JSON.parse(decodeURIComponent(options.type)))
		// console.log(JSON.parse(decodeURIComponent(options.item)));
		this.type = JSON.parse(decodeURIComponent(options.type))
		this.receiv = JSON.parse(decodeURIComponent(options.item));
	},
	methods: {
		swithBtn(e) {
			// console.log(e.detail.value)
			this.receiv.defult = e.detail.value;
		}
	}
};
</script>

<style lang="scss" scoped>
.addormodify {
	padding: 15px 15px 0px 15px;
	background-color: #f9faf9;
}
.modify {
	padding: 15px 14px 14px 26rpx;
	background-color: #ffffff;
}
.modify_sty {
	width: 25%;
	margin-right: 10rpx;
	font-size: 14px;
}
.modify_input {
	display: flex;
	margin-bottom: 56rpx;
	/deep/ .uni-icons {
		font-size: 26rpx !important;
		color: #c0c0c0 !important;
		margin: 0px 10px 0px 3px;
	}
}
.modify_paste {
	padding: 15px 14px 13px 24rpx;
}
.modify_default {
	display: flex;
	justify-content: space-between;
	padding: 30rpx;
	margin-top: 24rpx;
	margin-bottom: 60rpx;
}
.textSty {
	color: #c0c0c0;
	font-size: 28rpx;
}
.preservation {
	margin-bottom: 40rpx;
	border-radius: 20rpx;
	text {
		font-size: 28rpx;
	}
}
.delete {
	background-color: #ffffff;
	border-radius: 20rpx;
	text {
		font-size: 14px;
		color: #666666;
		text-align: center;
	}
}
// size
.size {
	font-size: 14px;
}
.flex {
	display: flex;
}
</style>
